<?php
    include_once '../service/Gallery_Service.php';

    $gallery        =   new Gallery_Service();
    $pro_id = $_GET['pro_id'];
    $table      =   "";
    $check = 0;
//    $limit      =   15;
//    $show_page  =   10;
//    $page       =   (isset($_GET['page']))? $_GET['page'] : 1;
//    $offset = ($page - 1) * $limit;
//    $rows = $gallery->getRows();
//    foreach ($rows as $value){
//            $totalRows = $value;
//    }
//    $totalPages = ceil($totalRows/$limit);
    $list_gallery   =   $gallery->getList_Gallery($pro_id);
    foreach ($list_gallery as $value){
        $id[]       = $value->getID();
        $image[]    = $value->getGal_Image();
        $check=1;
    }
?>
<div class="clear-block" style="margin-top: 10px;">
            <div class="node-form">
                <div class="standard">
                    <a style="float: right;margin-right: 43px;" class="button_add" href="index.php?action=ig&id=<?php echo $_GET['pro_id']; ?>" alt="">
                        <i class="add"></i>
                        <span class="uiButtonText">Upload images</span>
                    </a>
                        <fieldset class="menu-item-form collapsible collapsed">
                            <legend class="collapse-processed">
                                <a href="#">gallery Gallery</a>
                            </legend>
                            <div class="fieldset-wrapper">
                                <div class="gallery-line">
                                     <?php
                                            if($check == 1)
                                            {

                                                $i = 0;
                                                while($i < count($id))
                                                {
                                                    $table .='<div class="gallery-list ">
                                                                <div class="gallery-wrapper">
                                                                    <div class="gallery-image">
                                                                        <a href="/gallerys/view/14">
                                                                            <img width="145" border="0" title="Window Cleaning and Sealing" alt="Window Cleaning and Sealing" src="../uploads/thumb/'.$image[$i].'">
                                                                        </a>
                                                                    </div>
                                                                </div>
                                                            </div>';
                                                    $i++;
                                                }
                                            }
                                             else {
                                                $table = "don't have any project!!!";
                                            }
                                            echo $table;
                                        ?>


                                </div>
                            </div>


                        </fieldset>
                </div>
            </div>
</div>